<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
		<title>生命体征检测云平台</title>
		<link rel="shortcut icon" href="static/logo.ico" />
		<link rel="stylesheet" href="static/css/index.css" />
		<link rel="stylesheet" href="static/layui2.7.6/css/layui.css" />
		<script type="text/javascript" src="static/js/jquery.min.js"></script>
		<script src="static/layui2.7.6/layui.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="static/js/vue.js"></script>
		<script type="text/javascript" src="static/js/axios.min.js"></script>
		<style>
			html,
			body,
			#container {
				height: 100%;
				width: 100%;
			}

			.container {
				height: auto;
				width: 100%;
			}

			.container 2 {
				height: auto;
				width: 100%;
			}

			.collision-btn.disable {
				background-image: none;
				color: lightgrey;
				border-color: lightgrey;
				cursor: not-allowed;
			}

			.collision-btn.disable:hover {
				background-color: #fff;
				border-color: lightgrey;
			}

			.input-card .btn {
				margin-right: .8rem;
			}

			.amap-marker {
				opacity: 0.01;
			}

			.nav-right {
				top: 1.5rem !important;
			}

			.info {
				z-index: 999 !important;
			}

			.layui-form-label {
				width: 110px;
				font-size: 14px !important;
			}

			::-webkit-input-placeholder {
				/*Webkit browsers*/
				color: #999;
				font-size: 13px;
			}

			:-moz-placeholder {
				/*Mozilla Firefox 4 to 8*/
				color: #999;
				font-size: 13px;
			}

			::moz-placeholder {
				/*Mozilla Firefox 19+*/
				color: #999;
				font-size: 13px;
			}

			:-ms-input-placeholder {
				/*Internet Explorer 10+*/
				color: #999;
				font-size: 13px;
			}

			.layui-form-pane .layui-input {
				height: 38px !important;
			}

			.grid-demo {
				padding: 10px !important;
				line-height: 50px !important;
				text-align: center !important;
				background-color: #eeeeee !important;
				color: #063683 !important;
			}

			.layui-form-onswitch {
				border-color: #063683 !important;
				background-color: #063683 !important;
			}

			.layui-btn-normal {
				background-color: #063683;
			}

			.layui-form-pane .layui-form-radio,
			.layui-form-pane .layui-form-switch {
				margin-top: 6px;
				margin-left: 10px;
				position: absolute;
				z-index: 99999;
			}
		</style>
		
	</head>
	<body>
		<div id="app">
			<div style="margin-top: 70px;background-color: #e5e5e5;"></div>
			<div class="layui-panel" style="float: left; width: 10% !important;" id="pnav">

			</div>
			<div class="container" style="width: 90% !important; float: right;padding-left: 30px;">
				<div class="layui-fluid">
					<fieldset class="layui-elem-field layui-field-title">
						<legend>在床监测</legend>
					</fieldset>
					<div class="layui-btn-container">
						<a class="layui-btn  layui-btn-sm layui-btn-normal" style="float: right;margin-right:40px;"
							href="bed_monitoring_add.html">添加</a>
					</div>
					<div class="layui-bg-gray" style="padding: 30px; height: 100%;">
						<form style="margin-top: 10px" class="layui-form">
							<div class="layui-row layui-col-space15">
								<div class="layui-col-md6" v-for="(item,index) in elistData">
									<a href="javascript:;" v-on:click="doEditor(item)">
										<div class="layui-card">
											<div class="layui-card-header">
												<div style="float: left;">{{item.startTime}}~{{item.endTime}}</div>
												<div style="float: right;">采样间隔：<span v-if="item.isopen=='1'">开启</span>
													<span v-else>未开启</span>
												</div>
											</div>
											<div class="layui-card-body" style="height: 60px;">
												<div style="float: left;">定时监测：{{item.isWeekday}}</div>
												<div style="float: right; width: 6.25rem; height: 30px;">
													<input type="hidden" name="checkboxval" id="checkboxval">
														<!-- <input type="hidden" id="switchTest" :value="item.id" /> -->
														<input type="checkbox" name="open" lay-skin="switch"
															lay-filter="switchTest" lay-text="开|关"
															:checked="item.isopen=='1'" :value="item.id">
												</div>
											</div>
										</div>
									</a>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
			<div class="info">
				<div class="nav-left">
					<a class="login"></a>
					<a class="hometext" href="index.html" v-if="uInfoData.loginType !=1">首页</a>
					<a class="hometext" href="home.html" v-if="uInfoData.loginType == 1">首页</a>
				</div>
				<div class="nav-right">
					<ul>
						<li><a href="monitoring.html" v-if="uInfoData.loginType !=1">监测</a></li>
						<li><a href="historical_data.html" v-if="uInfoData.loginType !=1">历史数据</a></li>
						<li><a href="historical_info.html" v-if="uInfoData.loginType == 1">历史数据</a></li>
						<li><a href="call_p.html">离床报警</a></li>
						<li><a href="#">康养中心</a></li>
						<li><a href="#">中医问诊</a></li>
					</ul>
				</div>
				<div class="userinfo" id="userinfo">
					<img src="static/image/user.png" />
					<!-- <div class="red-dot"></div> -->
					<ul class="user_dropdown">
						<li class="dropdown_item user_ctrl">
							<div class="nickname">{{uInfoData.userName}}</div>
							<div class="sign_out">退出</div>
						</li>
						<li class="dropdown_item msg_item">
							<a href="user.html" target="_blank">
								<span>个人中心</span>
							</a>
						</li>
						<li class="dropdown_item msg_item">
							<a href="my_message.html" target="_blank">
								<span>我的消息</span>
								<span class="msg_unread unread_count show">5</span>
							</a>
						</li>
						<li class="dropdown_item">
							<a href="equipment.html">
								<span>设备</span>
							</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		
		<script>
			layui.use(['form', 'table', 'layedit', 'laydate', 'dropdown'], function() {
				var form = layui.form,
					layer = layui.layer,
					layedit = layui.layedit,
					laydate = layui.laydate;
				form.on('switch(switchTest)', function(data) {
					var id = data.value
					layer.tips('温馨提示：请注意切换到关闭状态，就是删除此条任务', data.othis)
		
					let datas = new FormData();
					datas.append('ids', id);
					axios({
							method: 'POST',
							url: url + "/custom/usettings/delLxtimes",
							data: datas
						})
						.then(function(response) {
							var message = response.data.message;
							layer.msg(message, {
								time: 2000,
								end: function() {
									location.href = 'bed_monitoring_list.html'
								}
							})
						})
		
				});
				laydate.render({
					elem: '#date1'
				});
				
				form.render();
			});
		</script>
		<script type="text/javascript" src="static/js/config.js"></script>
		<script>
			$(function() {
				$("#pnav").load("public_navigation.html");
				$(".sign_out").click(function() {
					localStorage.clear();
					window.location = 'login.html'
				});
			});
			var vm = new Vue({
				el: '#app', //设置当前vue对象可以操作数据的范围,注意不要把vue对象绑定到body中，因为这样，vue需要控制整个页面的内容，效率太低了
				data: {
					uInfoData: [],
					elistData: [],

				},
				ready: function() {
					// this.getdata();
				},
				created: function() {
					this.getdata();

				},
				methods: {
					getdata: function() {
						var rloginName = localStorage.loginName;
						var equName = localStorage.equName;
						// var equName = "06";
						console.log(rloginName);
						if (rloginName == '' || rloginName == 'null' || rloginName == undefined) {
							layer.msg('登录过期或者无权访问！', {
								time: 1000,
								end: function() {
									location.href = 'login.html'
								}
							})
						} else if (equName == '' || equName == 'null' || equName == undefined) {
							layer.msg('请绑定设备后查看！', {
								time: 1000,
								end: function() {
									location.href = 'equipment.html'
								}
							})
						} else {
							axios({
									method: 'GET',
									url: url + "/user/userInfo/lquserOwnInfo?phoneNum=" + rloginName,
									data: {}
								})
								.then(function(response) {
									console.log(response)
									vm.uInfoData = response.data;
								})
							let data = new FormData();
							data.append('equId', equName);
							axios({
									method: 'POST',
									url: url + "/custom/usettings/getLxtimes",
									data: data
								})
								.then(function(response) {
									console.log(response)
									vm.elistData = response.data;
								})
						}
					},
					doEditor: function(data) {
						localStorage["bedtask"] = '';

						var rloginName = localStorage.loginName;
						var bedtasks = localStorage.bedtask;
						let strMap = {
							'caijitime': data.caijitime,
							'endTime': data.endTime,
							'id': data.id,
							'isWeekday': data.isWeekday,
							'iscaijijiange': data.iscaijijiange,
							'isopen': data.isopen,
							'seqId': data.seqId,
							'shebeibeiguang': data.shebeibeiguang,
							'startTime': data.startTime,
							'familyId': "",
							'userPhone': rloginName

						}
						localStorage["bedtask"] = JSON.stringify(strMap);
						console.log(bedtasks)
						location.href = 'bed_monitoring_editor.html'
						var obj = bedtasks;
						console.log(obj[0])
					}
				}
			})
		</script>
	</body>
</html>
